<template>
  <div>
    <!--  头部  -->
    <header>
      <nav-top :classId="questionId"></nav-top>
    </header>
    <section>
      <!--    主体界面  -->
      <div class="main">
        <!--      等你回答  -->
        <div class="content">
          <div class="nav-top">
            <div
              @click="checkNavId(nav_index)"
              :class="{ active: is_nav === nav_index }"
              v-for="(nav_item, nav_index) in navItem"
              :key="nav_index"
              v-html="nav_item"
            ></div>
          </div>
          <div class="question-items">
            <div
              class="question-item-hot"
              v-for="(q_item, q_index) in questionItem"
              :key="q_index"
              v-show="is_nav === 0"
            >
              <div class="q-content">
                <h3>{{ q_item.question_title }}</h3>
                <div>
                  <span><i class="el-icon-edit"></i>写回答</span>
                  <span><i class="el-icon-plus"></i>关注问题</span>
                  <span><i class="el-icon-time"></i>稍后答</span>
                </div>
              </div>
              <div class="q-num-info">
                <div>
                  <span>{{ q_item.answer_num }}</span>
                  <span>回答</span>
                </div>
                <div>
                  <span>{{ q_item.look_num }}</span>
                  <span>浏览</span>
                </div>
              </div>
            </div>
            <div class="question-item-potential" v-show="is_nav === 1">
              潜力好问
            </div>
            <div class="question-item-new" v-show="is_nav === 2">
              新问题
            </div>
            <div class="question-item-answer" v-show="is_nav === 3">
              人人答
            </div>
          </div>
        </div>
        <!--    右侧导航    -->
        <nav-right></nav-right>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: "question.vue",
  data() {
    return {
      questionId: 3,
      navItem: [
        `<i class="icon-hot"></i>人气问题`,
        `<i class="icon-nav-new"></i>新问题`
      ],
      is_nav: 0,
      questionItem: [
        {
          question_title: "实习律师如何才能提升法律文书写作水平？",
          answer_num: 14,
          look_num: "22,552"
        },
        {
          question_title: "实习律师如何才能提升法律文书写作水平？",
          answer_num: 14,
          look_num: "22,552"
        },
        {
          question_title: "实习律师如何才能提升法律文书写作水平？",
          answer_num: 14,
          look_num: "22,552"
        },
        {
          question_title: "实习律师如何才能提升法律文书写作水平？",
          answer_num: 14,
          look_num: "22,552"
        }
      ]
    };
  },
  methods: {
    checkNavId(index) {
      this.is_nav = index;
    }
  }
};
</script>

<style scoped lang="less">
header {
  z-index: 9999;
  position: fixed;
  top: 0;
  width: 100%;
  padding: 10px 0;
  background-color: #fff;
  box-shadow: 0 2px 2px 0 rgba(237, 237, 237, 0.4);
}
section {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  padding-top: 15px;
  margin-top: 55px;
  background-color: #f6f6f6;

  .main {
    display: flex;
    justify-content: space-between;
    width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;

    .content {
      width: 69%;
      height: 100%;
      border-radius: 2px;
      box-sizing: border-box;
      box-shadow: 0 2px 2px 0 rgba(237, 237, 237, 0.4);
      .nav-top {
        display: flex;
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        border-radius: 2px;
        background-color: #fff;
        box-shadow: 0 2px 2px 0 rgba(237, 237, 237, 0.4);
        .active {
          background-color: rgba(107, 145, 71, 0.1);
          color: #6b9147;
        }
        & > div {
          padding: 8px 15px;
          margin-right: 20px;
          border-radius: 5px;
          font-size: 15px;
          color: #262625;
          background-color: rgba(149, 153, 143, 0.1);
          cursor: pointer;
          /deep/i {
            display: inline-block;
            width: 17px;
            height: 15px;
            margin-right: 5px;
            vertical-align: middle;
            background-size: 100% 100%;
          }
          &:hover {
            background-color: rgba(107, 145, 71, 0.1);
            color: #6b9147;
          }
        }
      }
      .question-items {
        .question-item-hot {
          display: flex;
          justify-content: space-between;
          padding: 25px 15px;
          margin-top: 15px;
          background-color: #fff;
          .q-content {
            & > h3 {
              color: #262625;
              cursor: pointer;
              &:hover {
                color: #689d35;
              }
            }
            & > div {
              margin-top: 20px;
              i {
                margin-right: 5px;
                font-weight: bold;
              }
              span:first-child {
                color: #689d35;
              }
              span {
                margin-right: 30px;
                font-size: 15px;
                color: #95998f;
                cursor: pointer;
              }
            }
          }
          .q-num-info {
            display: flex;
            margin-top: 20px;
            & > div {
              display: flex;
              flex-direction: column;
              margin-left: 40px;
              font-size: 15px;
              color: #95998f;
              text-align: center;
            }
          }
        }
      }
    }
  }
}
</style>
